import request from '@/utils/request'

// GlobalType
export interface GlobalType{
  // cateList:[],
  userid:string|number,
  nickname:string
}
// data的数据类型
export interface DataType {
  currentCategory:CurrentCategoryType,
  categoryItemList:CategoryItemListType[],
  categoryList:NavListType[]
}
// currentCategory 
export interface CurrentCategoryType{
  id: number,
  superCategoryId: number,
  showIndex: number,
  name: string,
  bannerList:BannerListType[]
}
// bannerList轮播图数据
export interface BannerListType{
  id: number,
  picUrl: string,
  targetUrl: string,
}
// NavList列表
export interface NavListType {
  id: number,
  superCategoryId: number,
  showIndex: number,
  name: string,
  frontName: string,
  frontDesc: string,
  type: 0,
}

// categoryItemList mian楼层的每一层
export interface CategoryItemListType{
  category:CategoryType,
  itemList:ItemListType[],

}


// ItemListList每一项
export interface ItemListType {
  id: number,
  listPicUrl: string,//背景图
  name: string,
  primarySkuId: number,
  retailPrice: number,//折扣价
  counterPrice: number,//原价
  pieceUnitDesc: string,//'件
  colorNum: number,//颜色可选数字
  itemTagList:ItemTagType [],//可用红包
  buttonType: number,//按钮的显示
  finalPriceInfoVO: FinalPriceInfoVOType,
  topLogo: {
      "logoUrl":string,//七周年
      "type": number
  },
  preLogo: [
      {
          "logoUrl": string,//小图标
          "type": number
      }
  ],
}
// 可用红包
export interface ItemTagType {
  type: number,
  name: string,
  tagId: number,
  itemId: number,
}

// 价格相关
export interface FinalPriceInfoVOType{ //价格相关
  banner: {
      content: string//满减
  },
  priceInfo: {
    finalPrice: {
        prefix: string,//到手
        price: string
    },
    counterPrice: string,//原价
    basicPrice:null
  },
}
// category
export interface CategoryType{
  id?: number|string,
  name: string,
  frontName: string,
  frontDesc: string,
}

// 居家生活接口
// export interface LiveHomeType  {
//   data:DataType,
//   global:GlobalType,
// }

export default {
  getLiveHome(id:number){
    return request.get<any,DataType>(`/item/list.json?__timestamp=1630136511866&categoryId=${id}`)
  }
}